/**主界面 */
class LoginMain extends eui.Component {
    public constructor() {
        super();
        this.skinName = "resource/assets/skins/gameLogin.exml";
        this.width = GlobalData.GameStage_width;
        this.height = GlobalData.GameStage_height;
        st_config.setScreenAuto(this);
        this.once(egret.Event.ADDED_TO_STAGE, this.onceMain, this);
    }
    /**主界面 */
    private main: eui.Group;

    //-----------------------------------------界面左上方功能键
    /**玩法按钮 */
    private wanfa: eui.Image;
    /**排行榜按钮 */
    private paihang: eui.Image;
    /**成就按钮 */
    // private chengjiutrue: eui.Image;

    //----------------------------------------界面右下方模式选择
    /**单机模式按钮 */
    private DanJiBtn: eui.Button;
    /**好友匹配按钮 */
    private FriendsPlay: eui.Button;
    /**联网模式按钮 */
    private LianWangBtn: eui.Button;
    // /**双摇杆模式按钮 */
    // private shuangYaoGan: eui.Button;
    /**敬请期待界面 */
    private explanationMain: eui.Group;
    /**敬请期待关闭 */
    private close: eui.Button;

    //----------------------------------------界面左下方联系我们
    /**联系我们按钮 */
    public lianxi: eui.Image;
    /**联系我们界面 */
    public lianxiwomen: eui.Group;
    /**联系我们界面确定 */
    public queding: eui.Image;

    //----------------------------------------界面左下方制作人员
    /**制作人员按钮 */
    private producerButton: eui.Image;
    /**制作人员滚动 */
    private producerGundong: eui.Group;
    /**制作人员group */
    private producerGroup: eui.Image;
    /**制作人员关闭 */
    private producerCloseButton: eui.Image;

    //----------------------------------------断线重连界面
    /**断线重连按钮 */
    private tryagain: eui.Image;
    /**链接中*/
    private connecting: eui.Group;
    /**链接失败 */
    private connecterror: eui.Group;

    //----------------------------------------饰品
    /**左边小云 */
    private cloudRot: eui.Image;
    /**右边大云 */
    private cloud: eui.Image;
    /**舌战群蛙logo */
    private mainlogo: eui.Image;

    //----------------------------------------游客模式
    /**游客提示 */
    private visitorShow: eui.Group;
    /**游客提示确认 */
    private visitorYes: eui.Image
    /**游客提示信息 */
    private visitorMsg: eui.Label;

    //-------------------------------------房间满重连
    /**重连界面 */
    private reconnection_Main: eui.Group;
    /**再次连接*/
    private reconnection_again: eui.Button;
    /**取消 */
    private reconnection_cancel: eui.Button;
    /**提示 */
    private reconnection_hint: eui.Label;

    //------------------------------------------杂项
    /**商店按钮 */
    private shop: eui.Image;
    /**新手指导 */
    public xinshou1;
    /**登陆反馈信息 */
    public static LoginBackMess = -1;
    /**背景音乐 */
    private bgSound: soundMgr = new soundMgr();
    /**邀请界面 */
    public invitationMain;
    /**登陆计时 */
    private loginTime: egret.Timer;
    /**测试新手引导按钮 */
    private testXinshou: eui.Button;
    /**屏幕适配 */
    public screenAdaptation() {
        GlobalData.changeDpi(this.main);
        GlobalData.changeDpi(this.producerGroup);
        GlobalData.changeDpi(this.lianxiwomen);
        GlobalData.changeDpi(this.reconnection_Main);
    }
    /**初始化界面 */
    public onceMain() {
        this.testXinshou.addEventListener(egret.TouchEvent.TOUCH_TAP, e => {
            this.xinshou1 = new xinshou();
            DataProl.isXinShou = true;
            this.addChild(this.xinshou1);
            this.main.visible = false;
        }, this);
        SoundManager.getInstance().soundLoad();
    }
    public createChildren() {
        this.DanJiBtn.visible = false;
        this.loginTime = new egret.Timer(200000, 0);
        this.loginTime.addEventListener(egret.TimerEvent.TIMER, this.loginDefeated, this);
        this.connecting.visible = false;
        if (DataProl.huoqu == false) {
            weixinManager.getInstance().askAccredit(this.getOpenid, this.onLoginCallBack).catch(e => { console.log(e); })

        }
        else {
            // DataProl.login_main_handle.StartGameMain();
            DataProl.login_main_handle = this;
            if (DataProl.login_main_handle != null) {
                DataProl.login_main_handle.loginFightServer();
                DataProl.login_main_handle.StartGameMain();
            }

            //return;
        }
        console.log("0-进入主界面");
        if (DataProl.shopaddr == null) {
            /**开启动画大时钟 */
            meterAanimation.getInstance().openClock();
            // wx.onShow(webNetworkMananger.getInstance().connect);
        }

        this.init();
        // webNetworkMananger.getInstance().connect();
    }
    /**制作人员名单 */
    private setProducer() {
        this.producerGroup.visible = false;
        this.producerButton.touchEnabled = true;
        this.producerButton.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
            SoundManager.getInstance().playButtonSound("click_mp3");
            egret.Tween.removeTweens(this.producerGundong);
            this.producerGundong.y = GlobalData.GameStage_height;
            this.producerGroup.visible = true;
            console.log("点击制作人员按钮");
            egret.Tween.get(this.producerGundong, { loop: true }).to({ y: -this.producerGundong.height }, 20000);
        }, this);
        this.producerCloseButton.touchEnabled = true;
        this.producerCloseButton.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
            this.producerGroup.visible = false;
            SoundManager.getInstance().playButtonSound("click_mp3");
        }, this);
    }
    private init() {

        this.screenAdaptation();
        // this.chengjiutrue.touchEnabled = false;
        // if (GlobalData.userShopData != null) {
        //     this.chengjiutrue.touchEnabled = true;
        // }
        this.LianWangBtn.visible = true;
        this.FriendsPlay.visible = false;
        if (DataProl.isEvenOnNet) {
            this.showNetMode();
        }

        this.visitorYes.addEventListener(egret.TouchEvent.TOUCH_TAP, e => { this.visitorShow.visible = false; }, this);
        SoundManager.getInstance().playBgSound(false, "1");
        SoundManager.getInstance().scene = 0;
        SoundManager.getInstance().sound_effect_switch = true;
        // wx.onShow(function () {
        //     if (SoundManager.getInstance().scene == 0) {
        //         SoundManager.getInstance().playBgSound(true, "game_mp3");
        //     }
        //     else if (SoundManager.getInstance().scene == 1) {
        //         SoundManager.getInstance().playBgSound(true, "main_mp3");
        //     }
        // });
        // this.startButton.visible = false;
        DataProl.login_main_handle = this;
        this.main.visible = true;
        this.visitorMsg.text = "连接超时，当前为游客模式";
        this.visitorShow.visible = false;
        /**商店 */
        this.shop.touchEnabled = true;

        this.shop.addEventListener(egret.TouchEvent.TOUCH_TAP, e => {
            SoundManager.getInstance().playEffectSound("click_mp3");
            if (DataProl.isVisitor) {
                this.visitorShow.visible = true;
                this.visitorMsg.text = "该机型尚不支持该功能";
            } else {
                this.addChild(gameShopData.getInstance());
                /**打开试用 */
            }
            console.log(gameShopData.getInstance().isHaveTry);
            if (GameOver.getInstance().isGameover == true) {
                if (gameShopData.getInstance().isHaveTry == false) {
                    console.log("打开试用");
                    gameShopData.getInstance().m_gameShopMgr.openTry();
                }


            }


            /**获取or更新蛙币 */
            gameShopData.getInstance().getUserMoney();
            SoundManager.getInstance().playEffectSound("click_mp3");
        }, this);

    }
    /**获取用户id */
    private getOpenid(callbacktmp: Function) {
        DataProl.login_main_handle.connecting.visible = true;
        var userinfo = weixinManager.getInstance().getUserInfo();
        var code = weixinManager.getInstance().getCode();
        var isweixin = "true";
        console.log("code:" + code);
        if (userinfo == null || code == null) {
            console.log("获取玩家微信失败");
            userinfo = DataProl.login_main_handle.getRandomPlayerData();
            gameGlobal.global.playerName = userinfo.nickName;
            code = DataProl.login_main_handle.getRandomOpenId();
            isweixin = "false";
        } else {
            console.log("获取玩家微信成功");
        }
        DataProl.login_data = userinfo;
        DataProl.login_main_handle.loginTime.start();
        let value = 'code=' + code + '&userinfo=' + JSON.stringify(userinfo) + '&isweixin=' + isweixin;
        console.log(value);
        // MiniNet.post('http://118.89.105.237:7000', '/wechat/auth', value, this, callbacktmp);
        //    MiniNet.post('http://172.16.18.54:9000', '/wechat/auth', value, this, callbacktmp);
        // MiniNet.post('http://172.16.19.104:8000', '/wechat/auth', value, this, callbacktmp);
        //MiniNet.post('http://118.89.105.237:9000', '/wechat/auth', value, this, callbacktmp);
        MiniNet.post('https://praying715.cn', '/wechat/auth', value, this, callbacktmp);
        // //-------------------------------------------------------------测试商店服
        // DataProl.shopaddr = "https://3oojs.cn";
        // DataProl.halladdr = "https://3oojs.cn";
        // DataProl.sign = "2fc5dace50517159a8c9539f98a866a6";
        // DataProl.account = 5911;
        // DataProl.login_main_handle.connectHall();
    }
    /**登陆失败回调--游客登陆*/
    private loginDefeated() {
        console.log("游客模式");
        this.connecting.visible = false;
        this.loginTime.stop();
        this.loginTime.removeEventListener(egret.TimerEvent.TIMER, this.loginDefeated, this);
        DataProl.isVisitor = true;
        DataProl.account = '00003017';
        this.StartGameMain();
    }
    /**生成随机信息 */
    private getRandomPlayerData() {
        return {
            avatarUrl: "",
            city: "",
            country: "China",
            gender: 1,
            language: "zh_CN",
            nickName: randomName.getInstance().getRandomName(),
            province: ""
        }
    }
    /**生成随机id */
    private getRandomOpenId(userinfo) {
        var d = Date.now();
        return d.toString();
    }
    public test() {
        let value = 'userid=' + DataProl.account + '&maxLong=' + 1000 + '&name=' + gameGlobal.global.playerName;
        MiniNet.post(DataProl.loginaddr, '/wechat/update', value, this, this.post);
    }
    public post() {
        console.log("111111111");
    }
    /**登录回调函数 */
    private onLoginCallBack(event: egret.Event): void {
        if (DataProl.isVisitor)
            return;
        console.log("3-登陆服回调");
        var request = <egret.HttpRequest>event.currentTarget;
        //登陆成功跳转界面
        let res = JSON.parse(request.response);
        if (res.errcode === 0) {
            DataProl.account = res.account;
            //DataProl.nickname = res.nickname;
            DataProl.halladdr = 'https://' + res.halladdr;
            // DataProl.login_main_handle.test();


            console.log(DataProl.halladdr);
            DataProl.sign = res.sign;
            console.log("加密" + DataProl.sign);
            DataProl.shopaddr = "https://" + res.halladdr;
            //---------------------------------------------测试
            //DataProl.shopaddr = 'http://172.16.19.104:8101';
            DataProl.maxLong = parseInt(res.maxLong);
            DataProl.xinshouyindao = res.isFirst;//////从服务器接到的新手引导的值   
            console.log("是否经历过新手引导：" + DataProl.xinshouyindao);
            //连接大厅服务器
            if (DataProl.login_main_handle != null)
                DataProl.login_main_handle.connectHall();
            //  DataProl.login_main_handle.StartGameMain();
            console.log("onLoginCallBack login sucess: 1111111111", res);

        } else {
            console.log("login fail: ");
        }
    }
    /**连接错误 */
    private ConnectError() {
        this.connecting.visible = false;
        this.connecterror.visible = false;
        // this.tryagain.addEventListener(egret.TouchEvent.TOUCH_BEGIN,e=>{this.init();},this);
    }
    // /**连接大厅 */
    private beConnectHall(callbacktmp: Function) {
        console.log("beConnectHall start: ");
        if (DataProl.halladdr === null || callbacktmp == null) {
            console.log("get hall address fail: ");
            return;
        }
        let value = 'account=' + DataProl.account + '&sign=' + DataProl.sign;
        console.log("beConnectHall value: " + value);
        var hallADR = DataProl.halladdr;
        console.log("hallADR: " + hallADR);
        //   hallADR="http://118.89.105.237:8101";
        //     hallADR="http://127.0.0.1:8101";
        MiniNet.post(hallADR, '/login', value, this, callbacktmp);
    }

    /**链接成功 */
    private async StartGameMain() {
        await platform.creatVideo();
        console.log("激励广告 加载成功");
        //this.initializeModeSelection();
        this.connecting.visible = false;
        this.connecterror.visible = false;
        this.DanJiBtn.visible = true;
        this.loginTime.stop();
        this.loginTime.removeEventListener(egret.TimerEvent.TIMER, this.loginDefeated, this);
        this.setProducer();
        this.close.addEventListener(egret.TouchEvent.TOUCH_TAP, e => {
            this.explanationMain.visible = false;
        }, this);
        //----------------------------------------------------------------------联网模式

        this.LianWangBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, e => {
            console.log("联网模式");

            SoundManager.getInstance().playEffectSound("click_mp3");
            this.initializeModeSelection();
            webNetworkMananger.isServerMove = true;

            this.visitorShow.visible = true;
            this.visitorMsg.text = "暂未开放该功能!敬请期待!";

            // let isFirst = this.isXinShou();
            // if (isFirst) {
            //     return;
            // }
            if (DataProl.gameaddr_ip == null) {
                console.log("未获取GAME地址");
                if (DataProl.login_main_handle != null) {
                    webNetworkMananger.getInstance().showErrorMessage("未获取战斗服地址，重新连接");
                    //DataProl.login_main_handle.connectHall();
                    return;
                }
            }
            DataProl.loginType = 1;
            webNetworkMananger.getInstance().intoFriendWaitRoom();
            // //测试联网把下面打开
            // webNetworkMananger.getInstance().intoRoom();
        }, this);
        //----------------------------------------------------------------------好友模式
        this.FriendsPlay.addEventListener(egret.TouchEvent.TOUCH_TAP, e => {
            this.initializeModeSelection();
            SoundManager.getInstance().playEffectSound("click_mp3");
            webNetworkMananger.isServerMove = true;
            DataProl.loginType = 1;
            webNetworkMananger.getInstance().intoFriendWaitRoom();
        }, this);
        //----------------------------------------------------------------------单机模式
        this.DanJiBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, e => {
            this.initializeModeSelection();
            DataProl.isSingleGame = true;
            let isFirst = this.isXinShou();
            if (isFirst) {
                return;
            }
            let value = 'userid=' + DataProl.account;
            MiniNet.post(DataProl.loginaddr, '/wechat/getTopPlayer', value, this, this.singMatch);
        }, this);
        // //----------------------------------------------------------------------5V5模式
        // this.tuanduizhan.addEventListener(egret.TouchEvent.TOUCH_TAP, e => {
        //     this.initializeModeSelection();
        //     DataProl.tuanduizhan = true;
        //     egret.Tween.removeTweens(this.tuanduizhan);
        //     this.tuanduizhan.y = 271.5;
        //     this.xuanz(this.tuanduizhan);
        // }, this);
        //----------------------------------------------------------------------双摇杆模式
        // this.shuangYaoGan.addEventListener(egret.TouchEvent.TOUCH_TAP, e => {
        //     DataProl.isDoubleRocker = true;
        //     webNetworkMananger.isServerMove = false;
        //     DataProl.isSingleGame = false;
        //     DataProl.tuanduizhan = false;
        //     egret.Tween.removeTweens(this.shuangYaoGan);
        //     this.shuangYaoGan.y = 368.5;
        //     this.xuanz(this.shuangYaoGan);
        // }, this);
        this.wanfa.touchEnabled = true;
        this.wanfa.addEventListener(egret.TouchEvent.TOUCH_TAP, e => {
            this.addChild(new playmethod());
            SoundManager.getInstance().playEffectSound("click_mp3");
        }, this);

        egretToWX.getInstance().setGameHandle(this);
        this.paihang.touchEnabled = true;
        this.paihang.addEventListener(egret.TouchEvent.TOUCH_TAP, this.paihangClick, this);
        this.lianxi.addEventListener(egret.TouchEvent.TOUCH_TAP, e => {
            SoundManager.getInstance().playEffectSound("click_mp3");
            this.lianxiwomen.visible = true;
        }, this);
        this.queding.addEventListener(egret.TouchEvent.TOUCH_TAP, e => {
            SoundManager.getInstance().playEffectSound("click_mp3");
            this.lianxiwomen.visible = false;
        }, this);

        /**成就系统点击开启关闭*/
        // this.chengjiutrue.addEventListener(egret.TouchEvent.TOUCH_TAP, e => {
        //     SoundManager.getInstance().playEffectSound("click_mp3");
        //     this.addChild(new achievementMag());
        // }, this);


    }
    /**获取单机匹配信息 */
    private singMatch(usrRecorData) {
        var shopsData = JSON.parse(usrRecorData.target.response);
        DataProl.todayMaxName = shopsData.result[0].name;
        DataProl.todayMaxGrade = shopsData.result[0].todayScore;
        let value = 'userid=' + DataProl.account;
        MiniNet.post(DataProl.loginaddr, '/wechat/getMyTodayTop', value, this, this.getMyGradeToTodayMax);
    }
    /**获取自己今日最高*/
    private getMyGradeToTodayMax(usrRecorData) {
        var myData = JSON.parse(usrRecorData.target.response);
        if (myData.result.length > 0) {
            DataProl.todayUserMaxGrade = myData.result[0].todayScore;
        }
        this.addChild(new MatchingInterface(1));
    }
    /**获取邀请信息 */
    public async getLaunchInfo() {
        let msg = await platform.getLaunchOptionsSync();
        //为邀请状态
        if (msg != null && msg.query.key1 != null) {
            DataProl.waitRoomId = parseInt(msg.query.key1);
            console.log("被邀成功:房间号是" + DataProl.waitRoomId);
            webNetworkMananger.isServerMove = true;
            DataProl.loginType = 2;
            webNetworkMananger.getInstance().intoFriendWaitRoom();
        } else {
            console.log("单人模式");
        }
    }
    /**测试邀请好友 */
    public test_invite() {
        DataProl.waitRoomId = 29;
        console.log("被邀成功:房间号是" + DataProl.waitRoomId);
        webNetworkMananger.isServerMove = true;
        DataProl.loginType = 2;
        webNetworkMananger.getInstance().intoFriendWaitRoom();
    }
    /**初始化模式选择 */
    public initializeModeSelection() {
        DataProl.isXinShou = false;
        DataProl.isSingleGame = false;
        DataProl.isDoubleRocker = false;
        DataProl.tuanduizhan = false;
        webNetworkMananger.isServerMove = false;
        DataProl.isCreateRockerPlayer = false;
        DataProl.isOpenRockerjudge = false;
        DataProl.loginType = 0;
        DataProl.friendId = -1;
    }
    /**是否触发新手引导 */
    public isXinShou() {
        SoundManager.getInstance().playEffectSound("click_mp3");
        DataProl.totalLenght = 0;
        //----------------------------------------测试新手引导
        //DataProl.xinshouyindao = 1;
        if (DataProl.xinshouyindao == 0) {
            DataProl.isXinShou = true;
            this.xinshou1 = new xinshou();
            this.addChild(this.xinshou1);
            this.main.visible = false;
            return true;
        } else {
            return false;
        }
    }
    /**显示邀请好友模式界面 */
    public showFriendMain() {
        console.log("进入邀请好友界面");
        this.invitationMain = new macthRoom();
        this.addChild(this.invitationMain);
    }
    /**排行榜点击触发事件 */
    public paihangClick() {
        if (DataProl.isVisitor) {
            this.visitorShow.visible = true;
            this.visitorMsg.text = "该机型尚不支持该功能";
        } else {
            egretToWX.getInstance().paihangBtnClick();
        }
    }
    // /**链接大厅成功 进入游戏内界面 */
    private onConnectHallSucess(event: egret.Event): void {

        console.log("onConnectHallSucess ttttt显示玩家出错的部分");
        var request = <egret.HttpRequest>event.currentTarget;
        console.log("onLoginCallBack get ttttttttt data : ", request.response);

        let res = JSON.parse(request.response);

        if (res.errcode === 0) {
            DataProl.gameaddr_ip = "";
            DataProl.gameaddr_ip = res.clientip;
            DataProl.gameaddr_port = res.clientport;
            console.log("onLoginCallBack get data ip: ", DataProl.gameaddr_ip);
            console.log("onLoginCallBack get data port : ", DataProl.gameaddr_port);

            if (DataProl.login_main_handle != null) {
                DataProl.login_main_handle.StartGameMain();
                this.loginFightServer();
            }

        }
        else {
            console.log("onConnectHallSucess fail: ");
        }
    }
    /**登陆战斗服 */
    private loginFightServer() {
        if (!DataProl.isEvenOnNet) {
            webNetworkMananger.getInstance().connect();
        } else {
            this.showNetMode();
        }
    }
    /**显示联网模式星球 */
    public showNetMode() {
        this.LianWangBtn.visible = true;
        this.FriendsPlay.visible = false;
    }
    /**玩家登陆 */
    private connectHall(): void {
        //this.bgSound.playerSound("resource/assets/sound/onclick.WAV", 1);
        console.log("4-connectHall start");
        if (DataProl.login_main_handle == null) {
            console.log("显示玩家出错的部分");
            return;
        }
        this.bgSound.closeSound();
        // this.beConnectHall(DataProl.login_main_handle.onConnectHallSucess);
        //获得所有商品信息
        console.log("4-connectHall finish");
        //this.test_invite();
        this.getUserSkin();
        MiniNet.post(DataProl.shopaddr, '/shop_getAllShop', "123test", this, this.shopCallBack);
    }
    //获取玩家的皮肤
    //////////////////////////////////////////////////////////////////////////////
    private getUserSkin() {
        //DataProl.account = 5923;
        console.log("userId：" + DataProl.account);
        MiniNet.post(DataProl.shopaddr, '/getUserSkin', 'accountId=' + DataProl.account, this, this.getUserSkinCallBack);
    }
    /**获取皮肤回调 */
    private getUserSkinCallBack(usrRecorData) {
        var shopsData = JSON.parse(usrRecorData.target.response);
        if (shopsData.shopData != null && shopsData.shopData != undefined) {
            GlobalData.userShopData = shopsData.shopData;
            console.log("获取用户皮肤成功" + shopsData);
            this.getUserRecord();
            this.saveUserSkin(shopsData.shopData);

        } else {
            console.log("获取玩家皮肤失败");
        }
    }
    /**获取玩家当前皮肤 */
    public saveUserSkin(userSkinData) {
        DataProl.userCurrentDressUp.decorateId = -1;
        DataProl.userCurrentDressUp.trailingId = -1;
        if (userSkinData != null) {
            for (let i = 0; i < userSkinData.length; i++) {
                if (parseInt(userSkinData[i].states) == 3) {
                    if (parseInt(userSkinData[i].shopType) == 0) {
                        DataProl.userCurrentDressUp.decorateId = userSkinData[i].shopId;
                    } else {
                        DataProl.userCurrentDressUp.trailingId = userSkinData[i].shopId;
                    }
                }
            }
        } else {
            console.log("获取玩家皮肤失败");
        }
    }
    //////////////////////////////////////////////////////////////////////////////


    /**获取记录部分 */
    //////////////////////////////////////////////////////////////////////////////
    /**获取用户成就进度 */
    private getUserRecord() {
        //发送测试代码
        MiniNet.post(DataProl.shopaddr, '/getUserRecord', 'accountId=' + DataProl.account, this, this.getUserRecordCallBack);
    }
    /**获取用户成就进度回调 */
    private getUserRecordCallBack(usrRecorData) {
        var shopsData = JSON.parse(usrRecorData.target.response);
        if (shopsData.shopData != null && shopsData.shopData != undefined) {
            GlobalData.usrRecorData = shopsData.shopData;
            //---------------------------------------------数据处理
            GlobalData.usrRecorData.KillNumber = parseInt(GlobalData.usrRecorData.KillNumber);
            GlobalData.usrRecorData.LineLength = parseInt(GlobalData.usrRecorData.LineLength);
            GlobalData.usrRecorData.InvoteFriends = parseInt(GlobalData.usrRecorData.InvoteFriends);
            GlobalData.usrRecorData.Weight = parseInt(GlobalData.usrRecorData.Weight);
            GlobalData.usrRecorData.VipNumbers = parseInt(GlobalData.usrRecorData.VipNumbers);
            GlobalData.attainmentTargets = shopsData.shopStandard;
            //  this.chengjiutrue.touchEnabled = true;
            console.log("玩家获得记录数" + shopsData);
        } else {
            console.log("获取玩家进度失败");
        }
    }
    //////////////////////////////////////////////////////////////////////////////


    //------------------------------------------------房间满重连部分
    /**显示重连界面 */
    public show_reconnection_Main() {
        this.reconnection_Main.visible = true;
        this.reconnection_again.addEventListener(egret.TouchEvent.TOUCH_TAP, this.reconnectionAgain, this);
        this.reconnection_cancel.addEventListener(egret.TouchEvent.TOUCH_TAP, this.reconnectionCancel, this);
    }
    /**再次进入房间 */
    private reconnectionAgain() {
        let m_AwesomeMessage = new awesomepackage.AwesomeMessage();
        let m_c2sEnterRoom = new awesomepackage.c2sEnterRoom();
        m_c2sEnterRoom.account = DataProl.account;
        m_c2sEnterRoom.waitRoomId = DataProl.waitRoomId;
        m_AwesomeMessage.meesageId = 1002;
        m_AwesomeMessage.data = awesomepackage.c2sEnterRoom.encode(m_c2sEnterRoom).finish();
        var buffer = awesomepackage.AwesomeMessage.encode(m_AwesomeMessage).finish();
        var byte2: egret.ByteArray = new egret.ByteArray(buffer);
        webNetworkMananger.getInstance().SendBitMeesage(byte2);
        this.reconnection_Main.visible = false;
        this.removeListener();
    }
    /**移除按钮监听 */
    private removeListener() {
        this.reconnection_again.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.reconnectionAgain, this);
        this.reconnection_cancel.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.reconnectionCancel, this);
    }
    /**取消进入房间 */
    private reconnectionCancel() {
        this.reconnection_Main.visible = false;
        this.removeListener();
    }

    /**获取商品回调 */
    private shopCallBack(shopData) {
        console.log("5-allShopCallBack");
        var shopsData = JSON.parse(shopData.target.response);
        GlobalData.shopsData = shopsData.shopData;
        MiniNet.post(DataProl.shopaddr, '/shop_getUserAdressUp', 'accountId=' + DataProl.account, this, this.userAdressCallBack);
    }
    /**获取玩家装扮回调 */
    private userAdressCallBack(date: any) {
        console.log("6-获取玩家装扮回调")
        var dressUp = JSON.parse(date.target.response);
        DataProl.userCurrentDressUp.decorateId = dressUp.dressData[0].DecorateId;
        DataProl.userCurrentDressUp.trailingId = dressUp.dressData[0].TrailingId;
        DataProl.userCurrentDressUp.userMoney = dressUp.dressData[0].userMoney;
        DataProl.userCurrentDressUp.sign = dressUp.dressData[0].sign;
        if (DataProl.login_main_handle != null)
            DataProl.login_main_handle.StartGameMain();
    }


}
